package com.pdg.android.splorr.data.enums;

import com.pdg.android.splorr.R;
import com.pdg.android.splorr.Utilities;

public enum WeaponType {
	NONE(0,0,0,0.0,null,null),
	DAGGER(R.string.item_name_dagger,10,1,0.1,new EquipSlot[]{EquipSlot.ON_HAND},new RoomState[]{RoomState.NONE}),
	SHORT_SWORD(R.string.item_name_short_sword,20,2,0.05,new EquipSlot[]{EquipSlot.ON_HAND},new RoomState[]{RoomState.NONE}),
	LONG_SWORD(R.string.item_name_long_sword,30,3,0.025,new EquipSlot[]{EquipSlot.ON_HAND},new RoomState[]{RoomState.NONE}),
	TWO_HANDED_SWORD(R.string.item_name_two_handed_sword,40,4,0.01,new EquipSlot[]{EquipSlot.ON_HAND,EquipSlot.OFF_HAND},new RoomState[]{RoomState.DEAD_END}),
	BATTLE_AXE(R.string.item_name_battle_axe,50,5,0.005,new EquipSlot[]{EquipSlot.ON_HAND},new RoomState[]{RoomState.DEAD_END});
	private RoomState[] roomStates;
	private EquipSlot[] equipSlots;
	private double frequency;
	private int attackValue;
	private int durability;
	private int stringId;

	WeaponType(int theStringId, int theDurability, int theAttackValue, double theFrequency, EquipSlot[] theEquipSlots, RoomState[] theRoomStates){
		setStringId(theStringId);
		setDurability(theDurability);
		setAttackValue(theAttackValue);
		setFrequency(theFrequency);
		setEquipSlots(theEquipSlots);
		setRoomStates(theRoomStates);
	}

	private void setRoomStates(RoomState[] theRoomStates) {
		roomStates = theRoomStates;
	}
	public RoomState[] getRoomStates(){
		return roomStates;
	}

	private void setEquipSlots(EquipSlot[] theEquipSlots) {
		equipSlots = theEquipSlots;
	}
	
	public EquipSlot[] getEquipSlots(){
		return equipSlots;
	}

	private void setFrequency(double theFrequency) {
		frequency = theFrequency;
	}
	
	public double getFrequency(){
		return frequency;
	}

	private void setAttackValue(int theAttackValue) {
		attackValue = theAttackValue;
	}
	
	public int getAttackValue(){
		return attackValue;
	}

	private void setDurability(int theDurability) {
		durability = theDurability;
	}
	
	public int getDurability(){
		return durability;
	}

	private void setStringId(int theStringId) {
		stringId = theStringId;
	}
	
	public int getStringId(){
		return stringId;
	}
	public int generateDurability() {
		return Utilities.roll(getDurability()/2,getDurability());
	}
	public boolean checkRoomState(RoomState theRoomState){
		for(RoomState temp:getRoomStates()){
			if(temp==theRoomState){
				return true;
			}
		}
		return false;
	}
}
